/*-------------------------连接数据库-----------------------------------------------------*/
//1.引入mongoose
const mongoose = require('mongoose');
//2.设置需要连接的数据库地址:schools 有就连接，没有就自动创建连接
const dbURL = 'mongodb://localhost:27017/schools';
//3.连接数据库
mongoose.connect(dbURL, { useNewUrlParser: true, useUnifiedTopology: true });
//4.设置连接成功提示
mongoose.connection.on('connected', () => console.log(dbURL + '数据库连接成功'));
/*-------------------------连接数据库-----------------------------------------------------*/